.PHONY: all default

BuildTime=`date -u '+%Y-%m-%d_%I:%M:%S%p'`
GitHash=`git rev-parse --short HEAD`
LDFlag="-w -s -X main.GitHash=${GitHash}"
VER=0.4.4
DIR=$(CURDIR)
Temp=/tmp/epg-mc

default: #bin .
	go build -ldflags=${LDFlag} -o ./epg-mc .

all: #build and package resource.
	rm -rf ${Temp}
	go build -ldflags=${LDFlag} -o ${Temp}/epg-mc .
	cp -rf ./scripts ${Temp}/scripts
	cp ./config.json ${Temp}
	cp ./sqlite.db ${Temp}
	cp -rf ./templates ${Temp}/templates
	cp -rf ./public ${Temp}/public
	cd ${Temp}/.. && tar zvcf epg-mc.${VER}.linux_amd64.tar.gz epg-mc && mv epg-mc.${VER}.linux_amd64.tar.gz ${DIR}/bin/
	echo "Pack Success!"
	
